﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Medical.Business;

public partial class control_InnerAd : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            DataTable dtBanner = new BisBanner().GetList(AdverTypeEnum.ArticleBanner);
            string strBanner = string.Empty;
            if (dtBanner != null && dtBanner.Rows.Count > 0)
            {
                if (!string.IsNullOrEmpty(dtBanner.Rows[0]["Url"].ToString()))
                {
                    strBanner = "<a href=\"" + dtBanner.Rows[0]["Url"].ToString() + "\" title=\"" + dtBanner.Rows[0]["Name"].ToString() + "\" target=\"_blank\">";
                }
                strBanner += "<img src=\"/" + WebConfigInfo.FilePlace + "d/" + dtBanner.Rows[0]["ImgPlace"].ToString() + "\" alt=\"" + dtBanner.Rows[0]["Name"].ToString() + "\" />";
                if (!string.IsNullOrEmpty(dtBanner.Rows[0]["Url"].ToString()))
                {
                    strBanner += "</a>";
                }
            }
            ltlArticleImg.Text = strBanner;
        }
    }
}